package com.ruoyi.project.platform.service.impl;

import java.util.List;

import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.framework.aspectj.lang.annotation.DataScope;
import com.ruoyi.framework.security.LoginUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.platform.mapper.PltUserSymbolMapper;
import com.ruoyi.project.platform.domain.PltUserSymbol;
import com.ruoyi.project.platform.service.IPltUserSymbolService;

/**
 * 用户币对Service业务层处理
 * 
 * @author ruoyi
 * @date 2020-07-27
 */
@Service
public class PltUserSymbolServiceImpl implements IPltUserSymbolService 
{
    @Autowired
    private PltUserSymbolMapper pltUserSymbolMapper;

    /**
     * 查询用户币对
     * 
     * @param symbolId 用户币对ID
     * @return 用户币对
     */
    @Override
    public PltUserSymbol selectPltUserSymbolById(Long symbolId)
    {
        return pltUserSymbolMapper.selectPltUserSymbolById(symbolId);
    }

    /**
     * 查询用户币对列表
     * 
     * @param pltUserSymbol 用户币对
     * @return 用户币对
     */
    @Override
    @DataScope(userAlias = "u")
    public List<PltUserSymbol> selectPltUserSymbolList(PltUserSymbol pltUserSymbol)
    {
        return pltUserSymbolMapper.selectPltUserSymbolList(pltUserSymbol);
    }

    /**
     * 新增用户币对
     * 
     * @param pltUserSymbol 用户币对
     * @return 结果
     */
    @Override
    public int insertPltUserSymbol(PltUserSymbol pltUserSymbol)
    {
        LoginUser currentUser = SecurityUtils.getLoginUser();
        pltUserSymbol.setUserId(currentUser.getUser().getUserId());
        pltUserSymbol.setUserName(currentUser.getUser().getUserName());
        return pltUserSymbolMapper.insertPltUserSymbol(pltUserSymbol);
    }

    /**
     * 修改用户币对
     * 
     * @param pltUserSymbol 用户币对
     * @return 结果
     */
    @Override
    public int updatePltUserSymbol(PltUserSymbol pltUserSymbol)
    {
        return pltUserSymbolMapper.updatePltUserSymbol(pltUserSymbol);
    }

    /**
     * 批量删除用户币对
     * 
     * @param symbolIds 需要删除的用户币对ID
     * @return 结果
     */
    @Override
    public int deletePltUserSymbolByIds(Long[] symbolIds)
    {
        return pltUserSymbolMapper.deletePltUserSymbolByIds(symbolIds);
    }

    /**
     * 删除用户币对信息
     * 
     * @param symbolId 用户币对ID
     * @return 结果
     */
    @Override
    public int deletePltUserSymbolById(Long symbolId)
    {
        return pltUserSymbolMapper.deletePltUserSymbolById(symbolId);
    }
}
